<template>
  <div>

    <el-select v-model="value" clearable placeholder="请选择" :disabled="values?true:false" >
      <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
    </el-select>
  </div>
</template>
<script>
import { plattomfun } from "@/api/menuManage";
export default {
  props: ['values'] ,
  data() {
    return {
      options: [],
      value: this.values
    };
  },
  watch: {
    value(val) {
      console.log(val)
      this.$emit("childfun", val);
    }
  },
  created() {
    this.listfun();
    console.log(this.values)
  },
  methods: {
    getMessage(res){
      console.log(res)
      this.value=res
    },
    listfun() {
      plattomfun().then(res => {
        if (res.data.code == 0) {
          console.log(res.data.data);
          let data = res.data.data;

          for (let i = 0; i < data.length; i++) {
            let sobj = {
              value: data[i].id,
              label: data[i].name
            };

            this.options.push(sobj);
          }
        }
      });
    }
  }
};
</script>
